package com.example.demo.controller;

import cn.dev33.satoken.stp.StpUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping(value = "page")
public class PageController {

    @GetMapping("login")
    public String login(Model model) {

        if(StpUtil.isLogin()) {
            return "scan";
        }

        return "login";
    }

    @GetMapping("index")
    public String index(Model model) {
        return "index";
    }

    @GetMapping("scan")
    public String scan(Model model) {
        return "scan";
    }

    @GetMapping("upload")
    public String upload(Model model) {
        return "upload";
    }

    @GetMapping("print_old")
    public String printOld(Model model) {
        return "print_old";
    }

    @GetMapping("logout")
    public String logout(Model model) {
        return "logout";
    }


}
